package org.jivesoftware.smack;

import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.net.SocketFactory;
import javax.net.ssl.SSLContext;
import org.apache.harmony.javax.security.auth.callback.CallbackHandler;
import org.jivesoftware.smack.proxy.ProxyInfo;
import org.jivesoftware.smack.util.DNSUtil;
import org.jivesoftware.smack.util.dns.HostAddress;

public class ConnectionConfiguration
  implements Cloneable
{
  private String serviceName;
  private String host;
  private int port;
  protected List<HostAddress> hostAddresses;
  private String truststorePath;
  private String truststoreType;
  private String truststorePassword;
  private String keystorePath;
  private String keystoreType;
  private String pkcs11Library;
  private boolean verifyChainEnabled = false;
  private boolean verifyRootCAEnabled = false;
  private boolean selfSignedCertificateEnabled = false;
  private boolean expiredCertificatesCheckEnabled = false;
  private boolean notMatchingDomainCheckEnabled = false;
  private boolean isRosterVersioningAvailable = false;
  private SSLContext customSSLContext;
  private boolean compressionEnabled = false;
  private boolean saslAuthenticationEnabled = true;
  private CallbackHandler callbackHandler;
  private boolean debuggerEnabled = Connection.DEBUG_ENABLED;
  private boolean reconnectionAllowed = true;
  private SocketFactory socketFactory;
  private String username;
  private String password;
  private String resource;
  private boolean sendPresence = true;
  private boolean rosterLoadedAtLogin = true;
  private SecurityMode securityMode = SecurityMode.enabled;
  protected ProxyInfo proxy;

  public ConnectionConfiguration(String paramString)
  {
    this.hostAddresses = DNSUtil.resolveXMPPDomain(paramString);
    init(paramString, ProxyInfo.forDefaultProxy());
  }

  protected ConnectionConfiguration()
  {
  }

  public ConnectionConfiguration(String paramString, ProxyInfo paramProxyInfo)
  {
    this.hostAddresses = DNSUtil.resolveXMPPDomain(paramString);
    init(paramString, paramProxyInfo);
  }

  public ConnectionConfiguration(String paramString1, int paramInt, String paramString2)
  {
    initHostAddresses(paramString1, paramInt);
    init(paramString2, ProxyInfo.forDefaultProxy());
  }

  public ConnectionConfiguration(String paramString1, int paramInt, String paramString2, ProxyInfo paramProxyInfo)
  {
    initHostAddresses(paramString1, paramInt);
    init(paramString2, paramProxyInfo);
  }

  public ConnectionConfiguration(String paramString, int paramInt)
  {
    initHostAddresses(paramString, paramInt);
    init(paramString, ProxyInfo.forDefaultProxy());
  }

  public ConnectionConfiguration(String paramString, int paramInt, ProxyInfo paramProxyInfo)
  {
    initHostAddresses(paramString, paramInt);
    init(paramString, paramProxyInfo);
  }

  protected void init(String paramString, ProxyInfo paramProxyInfo)
  {
    this.serviceName = paramString;
    this.proxy = paramProxyInfo;
    String str = System.getProperty("java.home");
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append(str).append(File.separator).append("lib");
    localStringBuilder.append(File.separator).append("security");
    localStringBuilder.append(File.separator).append("cacerts");
    this.truststorePath = localStringBuilder.toString();
    this.truststoreType = "jks";
    this.truststorePassword = "changeit";
    this.keystorePath = System.getProperty("javax.net.ssl.keyStore");
    this.keystoreType = "jks";
    this.pkcs11Library = "pkcs11.config";
    this.socketFactory = paramProxyInfo.getSocketFactory();
  }

  public void setServiceName(String paramString)
  {
    this.serviceName = paramString;
  }

  public String getServiceName()
  {
    return this.serviceName;
  }

  public String getHost()
  {
    return this.host;
  }

  public int getPort()
  {
    return this.port;
  }

  public void setUsedHostAddress(HostAddress paramHostAddress)
  {
    this.host = paramHostAddress.getFQDN();
    this.port = paramHostAddress.getPort();
  }

  public SecurityMode getSecurityMode()
  {
    return this.securityMode;
  }

  public void setSecurityMode(SecurityMode paramSecurityMode)
  {
    this.securityMode = paramSecurityMode;
  }

  public String getTruststorePath()
  {
    return this.truststorePath;
  }

  public void setTruststorePath(String paramString)
  {
    this.truststorePath = paramString;
  }

  public String getTruststoreType()
  {
    return this.truststoreType;
  }

  public void setTruststoreType(String paramString)
  {
    this.truststoreType = paramString;
  }

  public String getTruststorePassword()
  {
    return this.truststorePassword;
  }

  public void setTruststorePassword(String paramString)
  {
    this.truststorePassword = paramString;
  }

  public String getKeystorePath()
  {
    return this.keystorePath;
  }

  public void setKeystorePath(String paramString)
  {
    this.keystorePath = paramString;
  }

  public String getKeystoreType()
  {
    return this.keystoreType;
  }

  public void setKeystoreType(String paramString)
  {
    this.keystoreType = paramString;
  }

  public String getPKCS11Library()
  {
    return this.pkcs11Library;
  }

  public void setPKCS11Library(String paramString)
  {
    this.pkcs11Library = paramString;
  }

  public boolean isVerifyChainEnabled()
  {
    return this.verifyChainEnabled;
  }

  public void setVerifyChainEnabled(boolean paramBoolean)
  {
    this.verifyChainEnabled = paramBoolean;
  }

  public boolean isVerifyRootCAEnabled()
  {
    return this.verifyRootCAEnabled;
  }

  public void setVerifyRootCAEnabled(boolean paramBoolean)
  {
    this.verifyRootCAEnabled = paramBoolean;
  }

  public boolean isSelfSignedCertificateEnabled()
  {
    return this.selfSignedCertificateEnabled;
  }

  public void setSelfSignedCertificateEnabled(boolean paramBoolean)
  {
    this.selfSignedCertificateEnabled = paramBoolean;
  }

  public boolean isExpiredCertificatesCheckEnabled()
  {
    return this.expiredCertificatesCheckEnabled;
  }

  public void setExpiredCertificatesCheckEnabled(boolean paramBoolean)
  {
    this.expiredCertificatesCheckEnabled = paramBoolean;
  }

  public boolean isNotMatchingDomainCheckEnabled()
  {
    return this.notMatchingDomainCheckEnabled;
  }

  public void setNotMatchingDomainCheckEnabled(boolean paramBoolean)
  {
    this.notMatchingDomainCheckEnabled = paramBoolean;
  }

  public SSLContext getCustomSSLContext()
  {
    return this.customSSLContext;
  }

  public void setCustomSSLContext(SSLContext paramSSLContext)
  {
    this.customSSLContext = paramSSLContext;
  }

  public boolean isCompressionEnabled()
  {
    return this.compressionEnabled;
  }

  public void setCompressionEnabled(boolean paramBoolean)
  {
    this.compressionEnabled = paramBoolean;
  }

  public boolean isSASLAuthenticationEnabled()
  {
    return this.saslAuthenticationEnabled;
  }

  public void setSASLAuthenticationEnabled(boolean paramBoolean)
  {
    this.saslAuthenticationEnabled = paramBoolean;
  }

  public boolean isDebuggerEnabled()
  {
    return this.debuggerEnabled;
  }

  public void setDebuggerEnabled(boolean paramBoolean)
  {
    this.debuggerEnabled = paramBoolean;
  }

  public void setReconnectionAllowed(boolean paramBoolean)
  {
    this.reconnectionAllowed = paramBoolean;
  }

  public boolean isReconnectionAllowed()
  {
    return this.reconnectionAllowed;
  }

  public void setSocketFactory(SocketFactory paramSocketFactory)
  {
    this.socketFactory = paramSocketFactory;
  }

  public void setSendPresence(boolean paramBoolean)
  {
    this.sendPresence = paramBoolean;
  }

  public boolean isRosterLoadedAtLogin()
  {
    return this.rosterLoadedAtLogin;
  }

  public void setRosterLoadedAtLogin(boolean paramBoolean)
  {
    this.rosterLoadedAtLogin = paramBoolean;
  }

  public CallbackHandler getCallbackHandler()
  {
    return this.callbackHandler;
  }

  public void setCallbackHandler(CallbackHandler paramCallbackHandler)
  {
    this.callbackHandler = paramCallbackHandler;
  }

  public SocketFactory getSocketFactory()
  {
    return this.socketFactory;
  }

  public List<HostAddress> getHostAddresses()
  {
    return Collections.unmodifiableList(this.hostAddresses);
  }

  public void addHostAddress(String paramString, int paramInt)
  {
    if (this.hostAddresses == null)
    {
      initHostAddresses(paramString, paramInt);
    }
    else
    {
      HostAddress localHostAddress;
      try
      {
        localHostAddress = new HostAddress(paramString, paramInt);
      }
      catch (Exception localException)
      {
        throw new IllegalStateException(localException);
      }
      this.hostAddresses.add(localHostAddress);
    }
  }

  String getUsername()
  {
    return this.username;
  }

  String getPassword()
  {
    return this.password;
  }

  String getResource()
  {
    return this.resource;
  }

  boolean isRosterVersioningAvailable()
  {
    return this.isRosterVersioningAvailable;
  }

  void setRosterVersioningAvailable(boolean paramBoolean)
  {
    this.isRosterVersioningAvailable = paramBoolean;
  }

  boolean isSendPresence()
  {
    return this.sendPresence;
  }

  void setLoginInfo(String paramString1, String paramString2, String paramString3)
  {
    this.username = paramString1;
    this.password = paramString2;
    this.resource = paramString3;
  }

  public void initHostAddresses(String paramString, int paramInt)
  {
    this.hostAddresses = new ArrayList(1);
    HostAddress localHostAddress;
    try
    {
      localHostAddress = new HostAddress(paramString, paramInt);
    }
    catch (Exception localException)
    {
      throw new IllegalStateException(localException);
    }
    this.hostAddresses.add(localHostAddress);
  }

  public static enum SecurityMode
  {
    required, enabled, disabled;
  }
}

/* Location:           D:\hygieia\userclient\common\libs\easemobchat_2.1.8.jar
 * Qualified Name:     org.jivesoftware.smack.ConnectionConfiguration
 * JD-Core Version:    0.6.1
 */